<?php include "./configs/session_check.php";
include "./configs/config.php";


	

	
	 $userid=$_SESSION['userid'];
	 $default_logout="00:00:00";
	 $ActualLogOutTime=date("G:i:s");
	 
	 $logout_query="UPDATE `Logins`
					SET ActualLogOutTime='$ActualLogOutTime'
					WHERE EmployeeID = '$userid'
					AND ActualLogOutTime = '00:00:00'
					AND ActualLogInTime != '00:00:00'";
	/* 
	 $logout_query=("UPDATE Logins SET ActualLogOutTime='$ActualLogOutTime' WHERE EmployeeID='$userid' AND 	 ActualLogOutTime='$default_logout' AND ActualLogInTime !='$default_logout'"); */
	 $exc_logout_query=mysql_query($logout_query); 
   
    if($exc_logout_query ){
        $return['msg'] = 'Clocked Out!';
    }
    else
    {
        $return['msg'] = 'Failed';
    }

echo json_encode($return);